/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package startup;

import bmechat.gui.ClientFrame;
import bmechat.server.Server;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Jan
 */
public class setupServer {

    public static void main(String args[]) {
        try {
            String serverName = JOptionPane.showInputDialog("Please enter the name of your server.");
            String serverPassw = JOptionPane.showInputDialog("Please enter the administrator password.");
            int serverPort = 16688;
            int numberOfClients = Integer.parseInt(JOptionPane.showInputDialog("Please enter the number of clients."));
            String userName = JOptionPane.showInputDialog("Please enter your username.");

            String[] serverSetup = new String[4];
            serverSetup[0] = serverName;
            serverSetup[1] = serverPassw;
            serverSetup[2] = Integer.toString(serverPort);
            serverSetup[3] = Integer.toString(numberOfClients);
            
            Server.main(serverSetup);

            ClientFrame client = new ClientFrame(userName, "localhost", serverPort);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Unable to set up server: " + ex.getMessage());
        }
    }
}